package com.fr.lintcode;

public class Q982 {

    /**
     * @param A: an array
     * @return: the number of arithmetic slices in the array A.
     */
    public int numberOfArithmeticSlices(int[] A) {
        // Write your code here
    	int length = A.length;
    	int count = 0;
    	a :for(int i = 0; i <length ;){
    		int k = 0;
    		for(int j =i+1;j < length;j ++){
    			if(j - i == 1){
    				k = A[j] - A[i];
    			}else if(k == A[j] - A[j-1]){
    				count ++;
    			}else{
    				i++;
    				continue a;
    			}
    		}
    		i++;
    	}
    	return count;
    }


}
